<?php
if (!isset($_SESSION['logged']))
    print "<script language='javascript'>
        window.location.href='./?url=404';
        </script>";
else {
    $id = $_SESSION['id'];
    $sql = "SELECT * FROM `user` WHERE `id` = '$id';";
    $result = mysql_query($sql);
    $row = mysql_fetch_assoc($result);
    $name = $row['name'];
    $email = $row['email'];
?>
<div id="mainCol" class="clearfix">
    <h3 id="why">Edit Personal Info</h3>
    <ul id="maincon">
        <li class="clearfix last">
            <fieldset id="forms">
            <table width="100%">
                <form method="post" id="editpersonalform" action="?url=personalediting">
                    <tr>
                        <td width="25%"><b>Name:</b></td>
                        <td><input type="text" name="name" id="f_input" size="55" value="<?=$name;?>" /></td>
                    </tr>
                    <tr>
                        <td width="25%"><b>E-mail:<b></td>
                        <td><input type="text" name="email" id="f_input" size="55" value="<?=$email;?>" /></td>
                    </tr>
                    <tr>
                        <td colspan="2"><h6></h6><font size="1" color="red">Leave the new password field blank for unchange.</font></td>
                    </tr>
                    <tr>
                        <td width="25%"><b>New password:<b></td>
                        <td><input type="password" name="newpassword" id="f_input" /></td>
                    </tr>
                    <tr>
                        <td width="25%"><b>Repeat new password:</b></td>
                        <td><input type="password" name="repeatnewpassword" id="f_input" /></td>
                    </tr>
                    <tr>
                        <td colspan="2"><br><input type="submit" id="f_submit" name="save" value="Save" /></td>
                    </tr>
                </form>
            </table>
            </fieldset>
        </li>
    </ul>
</div>
<?
}
?>
